﻿Imports System.Web
Public Class ScriptBuilder
    Implements IHttpHandler

    ''' <summary>
    '''  You will need to configure this handler in the web.config file of your 
    '''  web and register it with IIS before being able to use it. For more information
    '''  see the following link: http://go.microsoft.com/?linkid=8101007
    ''' </summary>
#Region "IHttpHandler Members"

    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            ' Return false in case your Managed Handler cannot be reused for another request.
            ' Usually this would be false in case you have some state information preserved per request.
            Return True
        End Get
    End Property

    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

        ' Write your handler implementation here.

    End Sub

#End Region

#Region "Utility Methods "

    ''' <summary>
    ''' Adds a string pattern to the end of a string if it doesn't already end with the pattern
    ''' </summary>
    ''' <param name="input">The string that should end with the pattern</param>
    ''' <param name="pattern">The pattern which should be at the end of the input string</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected Function EndWith(ByVal input As String, ByVal pattern As String) As String
        If input.EndsWith(pattern) Then
            Return input
        End If
        Return input & pattern
    End Function

    ''' <summary>
    ''' Combines the code from various files into one script
    ''' </summary>
    ''' <param name="listOfScriptFiles"></param>
    ''' <remarks></remarks>
    Protected Sub BuildScriptSrc(ByVal listOfScriptFiles As List(Of String))

    End Sub

#End Region

End Class
